<?php defined('SYS_PATH') or die('No direct script access.');
/**
 * Controller class
 *
 * @author zendzhang<zendzhang@hotmail.com>
 * @version $Id: Controller.php 9 2013-01-14 03:24:50Z zendzhang@hotmail.com $
 */
abstract class TrueBlood_Controller extends TrueBlood
{
    /**
     * Get parameter
     *
     * @param string $name
     * @return object
     */
    protected function input($name, $default = null)
    {
        return $this->request->input($name, $default);
    }

    /**
     * Instantiate model by name
     *
     * @param string $name
     * @return object
     */
    protected function model($name)
    {
        return $this->load->model($name);
    }

    /**
     * Instantiate library by name
     *
     * @param string $name
     * @return object
     */
    protected function library($name)
    {
        return $this->load->library($name);
    }

    /**
     * Display view
     *
     * @param string $tpl
     * @param array $vars
     */
    protected function view($tpl, $vars = array())
    {
        $this->response->disableBrowserCache();
        $this->response->charset(CHARSET, 'text/html');
        $this->view->display($tpl, $vars);
    }

    /**
     * Redirect to $url
     *
     * @param string $url
     * @param int $time
     * @param int $code
     * @return void
     */
    protected function redirect($url, $time = 0, $code = 302)
    {
        $this->response->redirect($url, $time, $code);
    }
}

?>